package com.kefu.sys.vo;

import com.kefu.common.vo.AbstractInsertVo;
import com.kefu.sys.model.SysMenu;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;

import javax.validation.constraints.Size;

@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@ApiModel(description = "功能菜单")
public class SysMenuInsertVo extends AbstractInsertVo<SysMenu> {

    @ApiModelProperty(value = "主键")
    private String id;
    @Size(max = 20)
    @ApiModelProperty(value = "上级")
    private String parentId;
    @ApiModelProperty(value = "菜单名称")
    private String name;
    @ApiModelProperty(value = "菜单名称(英文)")
    private String nameEnUs;
    @ApiModelProperty(value = "排序")
    private Integer weight;
    @Size(max = 40)
    @ApiModelProperty(value = "前端标识")
    private String path;
    @Size(max = 16)
    @ApiModelProperty(value = "后端标识")
    private String code;
    @Size(max = 50)
    @ApiModelProperty(value = "图标")
    private String icon;
    @ApiModelProperty(value = "0无效，1有效")
    private Integer dataStatus;
    @Size(max = 100)
    @ApiModelProperty(value = "")
    private String component;
    @Size(max = 20)
    @ApiModelProperty(value = "")
    private String redirect;
    @ApiModelProperty(value = "")
    private Integer noCache;
    @ApiModelProperty(value = "")
    private Integer affix;
    @Size(max = 20)
    @ApiModelProperty(value = "")
    private String type;
    @ApiModelProperty(value = "")
    private Integer taskId;
    @ApiModelProperty(value = "是否隐藏")
    private Integer hidden;
    @ApiModelProperty(value = "")
    private Integer alwaysShow;

    @Override
    public SysMenu convert() {
        SysMenu info = new SysMenu();
	    info.setParentId(parentId);
	    info.setName(name);
        info.setNameEnUs(nameEnUs);
	    info.setWeight(weight);
	    info.setPath(path);
	    info.setCode(code);
	    info.setIcon(icon);
	    info.setDataStatus(dataStatus);
	    info.setComponent(component);
	    info.setRedirect(redirect);
	    info.setNoCache(noCache);
	    info.setAffix(affix);
	    info.setType(type);
	    info.setTaskId(taskId);
	    info.setHidden(hidden);
	    info.setAlwaysShow(alwaysShow);
        info.setId(id);
        info.setCreateTime(System.currentTimeMillis());
        return info;
	}
}